package com.niiwoo.civet.trade.enums.kaola;

import com.niiwoo.tripod.provider.exception.NoSuchEnumValueException;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 快付通银行code和cardbin映射
 *
 * @author lichuanzhi
 * @date 2018/02/08
 */

@AllArgsConstructor
@Getter
public enum BankCode2CardBinEnum {

    ABOC("ABOC","1031000","农业银行"),
    SPDB("SPDB","3102900","浦发银行"),
    ICBK("ICBK","1021000","工商银行"),
    PSBC("PSBC","0025840","邮政银行"),
    GDBK("GDBK","3065810","广发银行"),
    MSBC("MSBC","3051000","民生银行"),
    SZDB("SZDB","3135840","平安银行"),
    CMBC("CMBC","3085840","招商银行"),
    BKCH("BKCH","1041000","中国银行"),
    PCBC("PCBC","1051000","建设银行"),
    EVER("EVER","3031000","光大银行"),
    FJIB("FJIB","3091000","兴业银行"),
    CIBK("CIBK","3021000","中信银行"),
    HXBK("HXBK","3041000","华夏银行"),
    COMM("COMM","3011000","交通银行"),
    BJCN("BJCN","3131000","北京银行"),
    BOSH("BOSH","3135841","上海银行");

    private String bankCode;
    private String bankNo;
    private String desc;

    public static BankCode2CardBinEnum enumOf(String bankCode) {
        return Arrays.stream(values())
                     .filter(v -> v.getBankCode().equals(bankCode))
                     .findFirst()
                     .orElseThrow(() -> new NoSuchEnumValueException(String.valueOf(bankCode)));
    }

}
